<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title>查询结果-安平县全员核酸检测采集系统</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/main.css?v=05" rel="stylesheet" />
		<script src="layui/layui.js" charset="utf-8"></script>
		<style>
			body{background-color: #F2F2F7;}
		</style>
	</head>
		
	<body>
		<div class="title">安平县全员核酸检测采集系统</div>
      	<div style="color:red; text-align: center; margin-top: 10px;">说明：系统支持多次检测结果展示功能正在加紧开发，请大家耐心等待！</div>
		<div class="t2 b">查询结果</div>
		<div class="content" style="margin-bottom: 50px;">
			<div class="check_result">
				<span class="data_none">暂无数据</span>
				<ul id="J_List">
					<!-- <li>
						<div class="l">
							<span>李佩华</span>
							<label>131125**********2417</label>
						</div>
						<div class="r s1">
							待检测
						</div>
					</li>
					<li>
						<div class="l">
							<span>李佩华</span>
							<label>131125**********2417</label>
						</div>
						<div class="r s2">
							需复查
						</div>
					</li>
					<li>
						<div class="l">
							<span>李佩华</span>
							<label>131125**********2417</label>
						</div>
						<div class="r s3">
							阴性
						</div>
					</li>
					<li>
						<div class="l">
							<span>李佩华</span>
							<label>131125**********2417</label>
						</div>
						<div class="r s3">
							阴性
						</div>
					</li>
					<li>
						<div class="l">
							<span>李佩华</span>
							<label>131125**********2417</label>
						</div>
						<div class="r s3">
							阴性
						</div>
					</li> -->
				</ul>
				
			</div>
			<div class="tips">
                <p>待采样：请前往核酸检测采集点进行样本采集</p>
				<p>待检测：您的结果正在检测中，请耐心等待</p>
				<p>需复查/阳性：需进一步核验，稍后工作人员会与您取得联系</p>
                <p>阴性：结果正常，请务必做好防护！</p>
			</div>
		</div>
		<div class="footer">
			<p>安平县新冠肺炎疫情防控工作指挥部</p>
			<p>技术支持:智慧安平</p>
		</div>
		<script>
		layui.use(['layer', 'jquery'], function(){
		  var layer = layui.layer
		  ,$ = layui.jquery;
		  
			$(document).ready(function(){
				var loadIndex;
				var code = getQueryVariable('code');
				if(code){
                  	$.ajax({
                    	url:'http://user.city1000.cn:9999/hesuan/hsUser/getUsers2',
                      	data:{wxcode:code},
                      	beforeSend:function(){
                        	loadIndex = layer.load(1, { shade: [0.3, 'rgb(0, 0, 0)'] })
                        },
                      	success:function(res){
                        	if(res.code == 0){
                            	if(res.data.length > 0){
									res.data.forEach(item=>{
									    var card = item.idcard;
									    var newcard=card.replace(/^(.{4})(?:\d+)(.{4})$/,"$1******$2");
									    var status = '待采样';
									    var c = 's0';
									    if(item.istrue == 1){
									        status = '待检测';
									        c = 's1';
									    }
									    if(item.istrue == 2){
									        status = '阴性';
									        c = 's3';
									    }
									    if(item.istrue == 3){
									        status = '需复查/阳性';
									        c = 's2';
									    }
									    //var name = item.istrue > 0 ? item.name + ' 试管编号' + item.tubeId : item.name;
									    var li = '<li onClick="result(\''+item.id+'\','+item.istrue+')">';
									    li += '<div class="l">';
									    li += '<span>'+item.name+'<label style="margin-left: 10px;">'+newcard+'</label></span>';
									    if(item.istrue > 0){
									       li += '<span style="color: red; margin-top: 5px;">试管编号：'+item.tubeId+'</span>';
									    }
									    //li += '<label>'+newcard+'</label>';
									    li += '</div>';
									    li += '<div class="r '+c+'">';
									    li += '<span>'+status+'</span>';
									    if(item.istrue > 1){
									       li += '<label style="margin-top: 5px;">(报告单)</label>';
									    }
									    li += '</div>';
									    li += '</li>';
									    document.getElementById("J_List").innerHTML+=li;
									})
                                }else{
                                    $('.data_none').show();
                                    $('.tips').hide();
                                }          
                            }else{
                              	if(res.code == 4003  || res.code == 850){
                            		window.location.href='http://user.city1000.cn:9999/weixin/wechat/h5/redirectSomeWhere?url=http://hesuan.city1000.cn/check_result.html';
                                }else{
                                    layer.msg('当前人数较多，请稍后再试',{icon:2});
                                }
                            }
                        },
                      	error: function(xhr, textStatus, errorThrown){
    						layer.msg('当前人数较多，请稍后再试',{icon:2});
  						},
                      	complete:function(){
                        	layer.close(loadIndex); 
                        }
                    });
				}else{
					window.location.href='http://user.city1000.top/wechat/fetchResultData';
				}
			});
		});
        function result(uid,status){
        	if(status == 2 || status == 3){
              	//alert(uid);
            	//window.location.href='http://hesuan.city1000.cn/result_detail.html?id='+uid;
              	//window.location.href='http://hesuan.city1000.cn/result_detail.html?id='+ uid;
              	window.location.href='http://user.city1000.cn:9999/weixin/wechat/h5/redirectSomeWhere?url=http://hesuan.city1000.cn/result_detail.html&data='+uid;
            }
        }
		function getQueryVariable(variable)
		{
		    var query = window.location.search.substring(1);
		    var vars = query.split("&");
		    for (var i=0;i<vars.length;i++) {
		            var pair = vars[i].split("=");
		            if(pair[0] == variable){return pair[1];}
		    }
		    return(false);   
		}
		</script>
	</body>

</html>
